import {Routes} from '@angular/router';


import {HomeComponent} from './home/home.component';
import {LayoutComponent} from './layout/layout.component';
import {UserManageComponent} from './management/user-manage/user-manage.component';
import {RoleManageComponent} from './management/role-manage/role-manage.component';
import {LoginComponent} from './login/login.component';
import {BlankLayoutComponent} from './layout/blank-layout/blank-layout.component';
import {LoginGuard} from './login/login.guard';

export const ROUTES: Routes = [
  // Main redirect
  {path: '', redirectTo: 'home', pathMatch: 'full'},

  // App views
  {
    path: 'management',
    component: LayoutComponent,
    canActivate: [LoginGuard],
    children: [
      {path: 'user-manage', component: UserManageComponent},
      {path: 'role-manage', component: RoleManageComponent},
    ]
  },
  {
    path: '',
    component: LayoutComponent,
    canActivate: [LoginGuard],
    children: [
      {
        path: 'home',
        component: HomeComponent,
        canActivate: [LoginGuard]
      }
    ]
  },

  {
    path: '',
    component: BlankLayoutComponent,
    children: [{path: 'login', component: LoginComponent}]
  },
  // Handle all other routes
  {path: '**', redirectTo: 'home'}
];
